package com.view;

import com.app.App;
import com.dao.UserDao;
import com.dao.impl.UserDaoImpl;
import com.util.ReturnLevel;

import static com.util.Read.getIn;

public class RegisterView {
    private UserDao userDao = new UserDaoImpl();
    public void register(){
        System.out.println("请输入账号：");
        String name = getIn().next();
        System.out.println("请输入密码：");
        String pwd = getIn().next();
        int r= userDao.register(name,pwd);
        if(r>0){
            System.out.println("注册成功!");
            App.main();
        }else {
            System.out.println("注册失败!");
        }
        ReturnLevel.returnLevel();
    }
}
